package com.example.nationmobile;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Timer;

import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.decode.BaseImageDecoder;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;


import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;

public class SplashActivity extends Activity {

	
	private boolean ItUpdate = true;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// ==============================================
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.activity_splass);
		// ==============================================

		final Handler handler = new Handler();
		Runnable r = new Runnable() {
			public void run() {
				// Log.e("max","Update="+Count_Update+"");

				if (ItUpdate) {
					Timmer_To_main();
					ItUpdate = false;
				}

			}
		};

		
		ClearDataAll();
		
		handler.postDelayed(r, 2500);

	}
	 private void ClearDataAll()
	 {
		    Control.news_title="";
		    Control.news_description="";
		    Control.news_detail="";
		    Control.news_photo="";
		    
		    
		    Control.List_title0.clear();
		    Control.List_title1.clear();
		    Control.List_title2.clear();
		    Control.List_title3.clear();
		    Control.List_title4.clear();
		    Control.List_title5.clear();
		    Control.List_title6.clear();
		    Control.List_title7.clear();
		    Control.List_title8.clear();
		    Control.List_title9.clear();
		    Control.List_title10.clear();
		    Control.List_title11.clear();
		    Control.List_title12.clear();
		    Control.List_title13.clear();
		    Control.List_title14.clear();
		    Control.List_title15.clear();
		    Control.List_title16.clear();
		    Control.List_title17.clear();
		    Control.List_title18.clear();
		    Control.List_title19.clear();
		    Control.List_title20.clear();
		    Control.List_title21.clear();
		    Control.List_title22.clear();
		    Control.List_title23.clear();
		    Control.List_title_Opinoin.clear();
		    
		    Control.List_detail0.clear();
		    Control.List_detail1.clear();
		    Control.List_detail2.clear();
		    Control.List_detail3.clear();
		    Control.List_detail4.clear();
		    Control.List_detail5.clear();
		    Control.List_detail6.clear();
		    Control.List_detail7.clear();
		    Control.List_detail8.clear();
		    Control.List_detail9.clear();
		    Control.List_detail10.clear();
		    Control.List_detail11.clear();
		    Control.List_detail12.clear();
		    Control.List_detail13.clear();
		    Control.List_detail14.clear();
		    Control.List_detail15.clear();
		    Control.List_detail16.clear();
		    Control.List_detail17.clear();
		    Control.List_detail18.clear();
		    Control.List_detail19.clear();
		    Control.List_detail20.clear();
		    Control.List_detail21.clear();
		    Control.List_detail22.clear();
		    Control.List_detail23.clear();
		    Control.List_detail_Opinoin.clear();
		    
		    
		    Control.List_thumbnail0.clear();
		    Control.List_thumbnail1.clear();
		    Control.List_thumbnail3.clear();
		    Control.List_thumbnail2.clear();
		    Control.List_thumbnail4.clear();
		    Control.List_thumbnail5.clear();
		    Control.List_thumbnail6.clear();
		    Control.List_thumbnail7.clear();
		    Control.List_thumbnail8.clear();
		    Control.List_thumbnail9.clear();
		    Control.List_thumbnail10.clear();
		    Control.List_thumbnail11.clear();
		    Control.List_thumbnail12.clear();
		    Control.List_thumbnail13.clear();
		    Control.List_thumbnail14.clear();
		    Control.List_thumbnail15.clear();
		    Control.List_thumbnail16.clear();
		    Control.List_thumbnail17.clear();
		    Control.List_thumbnail18.clear();
		    Control.List_thumbnail19.clear();
		    Control.List_thumbnail20.clear();
		    Control.List_thumbnail21.clear();
		    Control.List_thumbnail22.clear();
		    Control.List_thumbnail23.clear();
		    Control.List_thumbnail_Opinoin.clear();
		   
		    
		    Control.List_description0.clear();
		    Control.List_description1.clear();
		    Control.List_description2.clear();
		    Control.List_description3.clear();
		    Control.List_description4.clear();
		    Control.List_description5.clear();
		    Control.List_description6.clear();
		    Control.List_description7.clear();
		    Control.List_description8.clear();
		    Control.List_description9.clear();
		    Control.List_description10.clear();
		    Control.List_description11.clear();
		    Control.List_description12.clear();
		    Control.List_description13.clear();
		    Control.List_description14.clear();
		    Control.List_description15.clear();
		    Control.List_description16.clear();
		    Control.List_description17.clear();
		    Control.List_description18.clear();
		    Control.List_description19.clear();
		    Control.List_description20.clear();
		    Control.List_description21.clear();
		    Control.List_description22.clear();
		    Control.List_description23.clear();
		    Control.List_description_Opinoin.clear();
		    
		    
		    Control.List_photo0.clear();
		    Control.List_photo1.clear();
		    Control.List_photo2.clear();
		    Control.List_photo3.clear();
		    Control.List_photo4.clear();
		    Control.List_photo5.clear();
		    Control.List_photo6.clear();
		    Control.List_photo7.clear();
		    Control.List_photo8.clear();
		    Control.List_photo9.clear();
		    Control.List_photo10.clear();
		    Control.List_photo11.clear();
		    Control.List_photo12.clear();
		    Control.List_photo13.clear();
		    Control.List_photo14.clear();
		    Control.List_photo15.clear();
		    Control.List_photo16.clear();
		    Control.List_photo17.clear();
		    Control.List_photo18.clear();
		    Control.List_photo19.clear();
		    Control.List_photo20.clear();
		    Control.List_photo21.clear();
		    Control.List_photo22.clear();
		    Control.List_photo23.clear();
		    Control.List_photo_Opinoin.clear();
		    
	 }
	
	private void Timmer_To_main() {
		startActivityForResult(new Intent(SplashActivity.this,
				MainActivity.class), 0);
		finish();

	}

	public boolean onKeyDown(int keyCode, KeyEvent event) {

		if (keyCode == KeyEvent.KEYCODE_BACK) {
			// this.displayConfirmationExit();
			/*
			 * ItUpdate=false; Intent myIntent= new Intent(Splass_Activity.this,
			 * LoginActivity2.class); startActivityForResult(myIntent, 0);
			 */
			finish();
			return true;
		}

		return super.onKeyDown(keyCode, event);
	}

	@Override
	public void onStop() {
		// TODO Auto-generated method stub
		// startActivityForResult(new Intent(Splass_Activity.this,
		// MainActivity.class), 0);
		// finish();
		super.onStop();
	}
	
	
	

}
